package com.zipsted.proto;

import javax.swing.*;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

/**
 * Created by zipSTED LLC.
 * User: edgar
 * Date: 08.09.11
 * Time: 4:59
 */
public class EntryPoint {
  private static final Simulation SIMULATION = new Simulation();

  private static final int FRAME_WIDTH = Renderer.RENDER_WIDTH;
  private static final int FRAME_HEIGHT = Renderer.RENDER_HEIGHT;

  public static void main(String[] args) {
    new Thread(SIMULATION).start();

    JFrame frame = new JFrame("Sandbox. Prototype");
    frame.getContentPane().add(SIMULATION);

    frame.addWindowListener(new WindowAdapter() {
      @Override
      public void windowClosing(WindowEvent ev) {
        SIMULATION.stopSimulating();
        System.exit(0);
      }

      @Override
      public void windowOpened(WindowEvent e) {
        System.out.println("we are in windowOpened()!");
      }
    });

    frame.setSize(FRAME_WIDTH, FRAME_HEIGHT);
    frame.setVisible(true);
    System.out.println("frame settings..");
  }

}
